Skip to content

Volume meshes

Volume Mesh Example

A tetrahedral mesh

VolumeMesh

Bases: Mesh

id_cells property

Shortcut for range(len(self.cells))

id_corners property

Shortcut for range(len(self.face_corners))

id_edges property

Shortcut for range(len(self.edges))

id_faces property

Shortcut for range(len(self.faces))

id_vertices property

Shortcut for range(len(self.vertices))

is_edge_on_border(*args)

Simple test to determine if a given edge is on the boundary of the mesh.

Returns:

Name Type Description
bool bool

Returns True if the given edge is on the boundary of the mesh.

is_face_on_border(*args)

Simple test to determine if a given face is on the boundary of the mesh.

Returns:

Name Type Description
bool bool

Returns True is the given face exists and is on the boundary of the mesh

is_tetrahedral()

Returns:

Name Type Description
bool bool

True if the mesh is tetrahedral (all cells are tetrahedra)

Volume Connectivity

Bases: _Connectivity

common_edge(iF1, iF2)

Returns the two vertices (u,v) of the edge that separates faces iF1 and iF2 if it exists, and (None,None) otherwise.

Parameters:

Name Type Description Default
iF1 int

first face index

required
iF2 int

second face index

required

Returns:

Type Description
(int, int)

(u,v) pair of vertex indices, or (None,None)

corner_to_face(C)

The face inside which corner C belongs.

Parameters:

Name Type Description Default
C int

corner id

required

Returns:

Name Type Description
int int

face id

direct_face(u, v, return_inds=False)

Pair (u,v) of vertex -> triangle to the left of edge (u,v) if edge (u,v) exists, None otherwise Also returns local indexes of u and v in the triangle (and None if (u,v) does not exists)

Calling this function with edge (v,u) yield the triangle of the other side of the edge

Parameters:

Name Type Description Default
u int

first vertex index

required
v int

second vertex index

required
return_inds bool

Whether to return local indices of u and v in the face. Defaults to False.

False

Returns:

Type Description

Index of a face or None. If return_inds is True, tuple made of index of face and local indices of u and v in face or (None,None,None).

edge_id(V1, V2)

id of an edge. If self.edges[i] contains edges (A,B), then edge_id(A,B)=edge_id(B,A)=i If (A,B) is not a valid edge of the mesh, returns None

Parameters:

Name Type Description Default
V1 int

first vertex of the edge

required
V2 int

second vertex of the edge

required

Returns:

Name Type Description
int int

the id of edge (V1,V2), or None if the edge does not exist.

edge_to_vertices(E)

Returns the two vertex indices that are adjacent to edge `E

Parameters:

Name Type Description Default
E int

edge index

required

Returns:

Name Type Description
list list

two vertex indices

face_id(*args)

The id of a face Args: int*: integers representing indices of vertices of the face (not necessarily in the correct order)

Returns:

Name Type Description
int int

A face index or None if the given tuple is invalid

face_to_corners(F)

list of corners of face F

Parameters:

Name Type Description Default
F int

face id

required

Returns:

Name Type Description
list list

list of corners of face F

face_to_edges(F)

List of edges that bound face F.

Parameters:

Name Type Description Default
F int

face id

required

Returns:

Name Type Description
list list

list of edges E such that E is a boundary edge of face F

face_to_faces(F)

List of faces that are adjacent to face `F

Parameters:

Name Type Description Default
F int

face id

required

Returns:

Name Type Description
list list

list of faces G that are adjacent to F

face_to_first_corner(F)

One corner C of the face F (the first in order of appearance in the face_corners container)

Parameters:

Name Type Description Default
F int

face id

required

Returns:

Name Type Description
int int

corner id

face_to_vertices(F)

Neighborhood of face F in terms of vertices.

Note

Equivalent to mesh.faces[F]

Parameters:

Name Type Description Default
F int

face id

required

Returns:

Name Type Description
list list

list of vertices V such that V is a vertex of F.

in_cell_index(C, V)

Index of vertex V in cell C. None if V is not in cell C

Parameters:

Name Type Description Default
C int

cell index

required
V int

vertex index

required

Returns:

Type Description

int

in_face_index(F, V)

Index of vertex V in face F. None if V is not in face F

Parameters:

Name Type Description Default
F int

face index

required
V int

vertex index

required

Returns:

Type Description

int

next_corner(C)

Next corner of C around its associated face

Parameters:

Name Type Description Default
C int

corner index

required

Returns:

Name Type Description
int int

index of the next corner

opposite_corner(C)

Opposite corner of C in terms of half edges. If C.vertex = A and C.next.vertex = B, then returns the corner D such that D.vertex = B and D.vertex.next = A

Parameters:

Name Type Description Default
C int

corner index

required

Returns:

Name Type Description
int int

index of the opposite corner

opposite_face(u, v, T, return_inds=False)

Given a pair of vertices (u,v) and a face T, returns the face (and local indexes of u and v) on the other side of edge (u,v)

if (u,v) are not two vertices of the face T, returns None

other_edge_end(E, V)

Vertex at the opposite end of edge E from vertex V. Returns None if V is not adjacent to edge E

Parameters:

Name Type Description Default
E int

edge id

required
V int

vertex id

required

Returns:

Name Type Description
int int

the vertex W such that E is the edge (V,W). Returns None if V is not adjacent to edge E

previous_corner(C)

Previous corner of C around its associated face

Parameters:

Name Type Description Default
C int

corner index

required

Returns:

Name Type Description
int int

index of the previous corner

vertex_to_corner_in_face(V, F)

The corner C corresponding to vertex V in face F.

Parameters:

Name Type Description Default
V int

vertex id

required
F int

face id

required

Returns:

Name Type Description
int int

corner id, or None if V is not a vertex of F.

vertex_to_corners(V)

List of face corners that correspond to vertex V

Parameters:

Name Type Description Default
V int

vertex id

required

Returns:

Name Type Description
list list

the list of corners C such that mesh.corners[C]==V

vertex_to_edges(V)

Neighborhood of vertex V in terms of edges.

Parameters:

Name Type Description Default
V int

vertex id

required

Returns:

Name Type Description
list list

list of edges E such that V belongs to E.

vertex_to_faces(V)

Neighborhood of vertex V in terms of faces.

Parameters:

Name Type Description Default
V int

vertex id

required

Returns:

Name Type Description
list list

list of faces F such that V is a vertex of F.

vertex_to_vertices(V)

Neighborhood of vertex V in terms of vertices.

Parameters:

Name Type Description Default
V int

vertex id

required

Returns:

Name Type Description
list list

list of vertices W such that (V,W) is a valid edge in the polyline.